package com.example.sangong.controller;

import com.example.sangong.http.Result;
import com.example.sangong.req.Req;
import com.example.sangong.req.user.UserLoginReq;
import com.example.sangong.resp.UserLoginResp;
import com.example.sangong.service.SgUserService;
import io.swagger.annotations.Api;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

@RestController
@RequestMapping("/user")
@Api(tags = "用户管理")
public class UserController {
    @Resource
    private SgUserService sgUserService;

    @PostMapping("/login")
    public Result<UserLoginResp> login(@RequestBody Req<UserLoginReq> param) {
        return Result.success( sgUserService.login(param.getReq()));
    }
}
